package com.xuelang.pipeline.domain.pipeline.repository;

import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.pipeline.dto.PipelineQuery;
import com.xuelang.pipeline.domain.pipeline.Pipeline;

import java.util.List;

/**
 * 流水线仓库
 *
 * @author liuyuan.ly
 * @since 2024/5/14 9:48
 */
public interface PipelineRepository {
    /**
     * 获取流水线列表，有过滤条件
     *
     * @param currentPage
     * @param pageSize
     * @param pipelineQuery
     * @return
     */
    PageRecord<Pipeline> pageList(long currentPage, long pageSize, PipelineQuery pipelineQuery);
    /**
     * 获取流水线列表，有过滤条件
     *
     * @param pipelineQuery
     * @return
     */
    List<Pipeline> list(PipelineQuery pipelineQuery);

    /**
     * 新增流水线
     *
     * @param pipeline
     * @return
     */
    Boolean save(Pipeline pipeline);

    /**
     * 更新流水线
     *
     * @param pipeline
     * @return
     */
    Boolean update(Pipeline pipeline);
    /**
     * 删除流水线
     *
     * @param code
     * @return
     */
    Boolean delete(String code);

    /**
     * 判断流水线编码是否存在
     *
     * @param pipelineCode
     * @return
     */
    Boolean existsCode(String pipelineCode);

    /**
     * 判断流水线名称是否存在
     *
     * @param pipelineCode
     * @param pipelineName
     * @return
     */
    Boolean existsName(String pipelineCode, String pipelineName);

    /**
     * 获取流水线
     *
     * @param code
     * @return
     */
    Pipeline query(String code);

    /**
     *
     * @param componentLabel
     * @return
     */
    List<Pipeline> queryByComponentLabel(String componentLabel);

    /**
     * 获取流水线列表
     *
     * @param pipeline
     * @return
     */
    List<Pipeline> list(Pipeline pipeline);
    /**
     * 该环境是否存在关联流水线
     *
     * @param environmentUuid
     * @return
     */
    Boolean existsByEnvironmentUuid(String environmentUuid);
}
